﻿<UserControl x:Class="GIMS.GUI.ArgumentControls.DrawArgumentControl"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="300">
    <UserControl.Resources>
        <BooleanToVisibilityConverter x:Key="boolToVisibilityConverter" />
    </UserControl.Resources>
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
            <RowDefinition Height="Auto" />
        </Grid.RowDefinitions>
        <Grid.ColumnDefinitions>
            <ColumnDefinition Width="Auto" />
            <ColumnDefinition Width="Auto" />
        </Grid.ColumnDefinitions>

        <StackPanel Orientation="Horizontal" >
            <TextBlock>Shape:</TextBlock>

            <ComboBox ItemsSource="{Binding Path=ShapeRepresenters}"
                      DisplayMemberPath="Name"
                      SelectedValuePath="Value"
                      SelectedValue="{Binding Path=DrawArgument.Shape}" Margin="3"></ComboBox>
        </StackPanel>

        <!-- Point 0 -->    
        <Grid Grid.Row="1" MinWidth="150" >
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="65" />
                <ColumnDefinition Width="65" />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" Grid.Column="0" Margin="3">Point0 X:</TextBlock>
            <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Path=DrawArgument.P0X, ValidatesOnExceptions=True}" Margin="3" />
            <TextBlock Grid.Row="1" Grid.Column="0" Margin="3">Point0 Y:</TextBlock>
            <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Path=DrawArgument.P0Y, ValidatesOnExceptions=True}" Margin="3" />
        </Grid>

        <!-- Point 1 -->
        <Grid Grid.Row="1" Grid.Column="2"
              MinWidth="150"
              Visibility="{Binding Path=IsNotText, Converter={StaticResource boolToVisibilityConverter}}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto" />
                <RowDefinition Height="Auto" />
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="65" />
                <ColumnDefinition Width="65" />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" Grid.Column="0" Margin="3">Point1 X:</TextBlock>
            <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Path=DrawArgument.P1X, ValidatesOnExceptions=True}" Margin="3" />
            <TextBlock Grid.Row="1" Grid.Column="0" Margin="3">Point1 Y:</TextBlock>
            <TextBox Grid.Row="1" Grid.Column="1" Text="{Binding Path=DrawArgument.P1Y, ValidatesOnExceptions=True}" Margin="3" />
        </Grid>

        <!-- Text -->
        <Grid Grid.Row="3" Grid.ColumnSpan="2"
              MinWidth="150"
              Visibility="{Binding Path=IsText, Converter={StaticResource boolToVisibilityConverter}}">
            <Grid.RowDefinitions>
                <RowDefinition Height="Auto"/>
            </Grid.RowDefinitions>
            <Grid.ColumnDefinitions>
                <ColumnDefinition Width="65" />
                <ColumnDefinition Width="280" />
            </Grid.ColumnDefinitions>

            <TextBlock Grid.Row="0" Grid.Column="0" Margin="3">Text:</TextBlock>
            <TextBox Grid.Row="0" Grid.Column="1" Text="{Binding Path=DrawArgument.Text, ValidatesOnExceptions=True}" Margin="3" />
        </Grid>

    </Grid>
</UserControl>
